package com.telesound.dataimport;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.sql.DataSource;

import com.telesound.dataimport.util.DateUtil;
import com.telesound.dataimport.util.MD5Util;

/**
 * 数据库操作封装工具类
 * @author zhangchaofeng
 * @version 1.0
 * @date Sep 26, 2011
 */
public class DBAccess {
	private static DataSource ds;

	static {
		/*String driverClassName="oracle.jdbc.driver.OracleDriver";
		String url = "jdbc:oracle:thin:@192.168.4.104:1521:SXNET";
		String user = "bankweb";
		String password = "bank";
		
		BasicDataSource bds=new BasicDataSource();
        bds.setDriverClassName(driverClassName);
        bds.setUsername(user);
        bds.setPassword(password);
        bds.setUrl(url);
        bds.setInitialSize(50);
        bds.setMaxActive(-1);
        bds.setMaxIdle(-1);
        bds.setMinIdle(0);
        bds.setMaxWait(-1);
        DBAccess.ds=bds;*/
        try {
			/*Context initCtx = new InitialContext();
			DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/sxnet");
			if(ds==null){
				throw new NamingException("找不到名称为jdbc/sxnet的数据源。");
			}*/
//        	String classPath=Thread.currentThread().getContextClassLoader().getResource("").getPath();
//			ApplicationContext ac = new FileSystemXmlApplicationContext(classPath+"/applicationContext.xml");
//			DataSource ds=(DataSource)ac.getBean("dataSource");
//			DBAccess.ds=ds;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/*public static void setDataSource(DataSource ds){
		DBAccess.ds=ds;
	}
	
	public static void setDataSource(String dataSourceName){
		try {
			Context initCtx = new InitialContext();
			DataSource ds = (DataSource)initCtx.lookup("java:comp/env/"+dataSourceName);
			if(ds==null){
				throw new NamingException("找不到名称为jdbc/"+dataSourceName+"的数据源。");
			}
			DBAccess.ds=ds;
		} catch (NamingException e) {
			e.printStackTrace();
		}
	}*/
	
	private static Connection getConnection() throws SQLException{
		return ds.getConnection();
	}
	
	public static String getUuid(){
		String uuid=UUID.randomUUID().toString();
		return MD5Util.encode(uuid);
	}

	/**
	 * 执行insert/delete语句，一个参数列表
	 * @param sql 语句
	 * @param args 参数列表
	 * @return 成功或失败
	 */
	public static boolean excute(String sql, List args) {
		boolean result = false;
		Connection connection=null;
		PreparedStatement pstmt=null;
		try {
			connection=getConnection();
			connection.setAutoCommit(false);
			pstmt = connection.prepareStatement(sql);
			if (args != null && sql.contains("?")) {
				for (int i = 0; i < args.size(); i++) {
					pstmt.setObject(i + 1, args.get(i));
				}
			}
			result = pstmt.executeUpdate()>0;
			connection.commit();
		} catch (Exception e) {
			e.printStackTrace();
			try {
				connection.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}finally{
			try {
				pstmt.close();
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return result;
	}
	
	public static boolean excuteWithException(String sql, List args) throws Exception {
		boolean result = false;
		Connection connection=null;
		PreparedStatement pstmt=null;
		try {
			connection=getConnection();
			connection.setAutoCommit(false);
			pstmt = connection.prepareStatement(sql);
			if (args != null && sql.contains("?")) {
				for (int i = 0; i < args.size(); i++) {
					pstmt.setObject(i + 1, args.get(i));
				}
			}
			result = pstmt.executeUpdate()>0;
			connection.commit();
		} catch (Exception e) {
			e.printStackTrace();
			try {
				connection.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
			throw new Exception(e.getMessage());
		}finally{
			try {
				pstmt.close();
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return result;
	}

	/**
	 * 执行insert/delete语句，多个参数列表
	 * @param sql 语句
	 * @param args 参数列表
	 * @return 成功或失败
	 */
	public static int[] excuteBatch(String sql, List args) {
		int[] result = new int[]{0};
		Connection connection=null;
		PreparedStatement pstmt=null;
		try {
			connection=getConnection();
			connection.setAutoCommit(false);
			pstmt = connection.prepareStatement(sql);
			if (args != null && sql.contains("?")) {
				for (int i = 0; i < args.size(); i++) {
					List arg = (List) args.get(i);
					for (int j = 0; j < arg.size(); j++) {
						pstmt.setObject(j + 1, arg.get(j));
					}
					pstmt.addBatch();
				}
			}
			result=pstmt.executeBatch();
			connection.commit();
		} catch (SQLException e) {
			e.printStackTrace();
			try {
				connection.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}finally{
			try {
				pstmt.close();
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return result;
	}

	/**
	 * 执行update语句
	 * @param sql 语句
	 * @param args 参数列表
	 * @return 成功条数
	 */
	public static int executeUpdate(String sql, List args) {
		int count = 0;
		Connection connection=null;
		PreparedStatement pstmt=null;
		try {
			connection=getConnection();
			connection.setAutoCommit(false);
			pstmt = connection.prepareStatement(sql);
			if (args != null && sql.contains("?")) {
				for (int i = 0; i < args.size(); i++) {
					pstmt.setObject(i + 1, args.get(i));
				}
			}
			count = pstmt.executeUpdate();
			connection.commit();
		} catch (SQLException e) {
			e.printStackTrace();
			try {
				connection.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}finally{
			try {
				pstmt.close();
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return count;
	}

	/**
	 * 执行update语句，多个参数列表
	 * @param sql 语句
	 * @param args 参数列表
	 * @return 成功条数
	 */
	public static int executeBatchUpdate(String sql, List args) {
		int count = 0;
		Connection connection=null;
		PreparedStatement pstmt=null;
		try {
			connection=getConnection();
			connection.setAutoCommit(false);
			pstmt = connection.prepareStatement(sql);
			if (args != null && sql.contains("?")) {
				for (int i = 0; i < args.size(); i++) {
					List arg = (List) args.get(i);
					for (int j = 0; j < arg.size(); j++) {
						pstmt.setObject(j + 1, arg.get(j));
					}
					int num = pstmt.executeUpdate();
					if (num != -1) {
						count = count + num;
					}
				}
			}
			connection.commit();
		} catch (SQLException e) {
			e.printStackTrace();
			try {
				connection.rollback();
			} catch (SQLException e1) {
				e1.printStackTrace();
			}
		}finally{
			try {
				pstmt.close();
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return count;
	}
	
	public static boolean saveObject(Object obj){
		List args=new ArrayList();
		StringBuffer sql1=new StringBuffer("insert into ");
		StringBuffer sql2=new StringBuffer(") values (");
		Class clazz=obj.getClass();
		String className=clazz.getSimpleName();
		StringBuffer tableName=new StringBuffer(""+Character.toLowerCase(className.charAt(0)));
		for(int i=1;i<className.length();i++){
			char ch=className.charAt(i);
			if(Character.isLowerCase(ch)){
				tableName.append(ch);
			}else{
				tableName.append("_");
				tableName.append(Character.toLowerCase(ch));
			}
		}
		sql1.append(tableName+" (");
		Field[] fields=clazz.getDeclaredFields();
		for(int i=0;i<fields.length;i++){
			Field field=fields[i];
			if(!isCommonField(field)){
				continue;
			}
			String fieldName=field.getName();
			Class fieldType=field.getType();
			String getMethodName="get"+(fieldName.charAt(0)+"").toUpperCase()+fieldName.substring(1,fieldName.length());
			Object value=null;
			try {
				Method getMethod=clazz.getMethod(getMethodName, new Class[]{});
				value=getMethod.invoke(obj, new Object[]{});
				if(value==null){
					continue;
				}
				if(fieldType==Date.class){
					Date d=(Date)value;
					value=new java.sql.Date(d.getTime());
				}
				args.add(value);
			} catch (Exception e) {
				e.printStackTrace();
			}
			StringBuffer columnName=new StringBuffer(""+Character.toLowerCase(fieldName.charAt(0)));
			for(int j=1;j<fieldName.length();j++){
				char ch=fieldName.charAt(j);
				if(Character.isLowerCase(ch)){
					columnName.append(ch);
				}else{
					columnName.append("_");
					columnName.append(Character.toLowerCase(ch));
				}
			}
			sql1.append(columnName+",");
			sql2.append("?,");
		}
		if(sql1.charAt(sql1.length()-1)==','){
			sql1.deleteCharAt(sql1.length()-1);
		}
		if(sql2.charAt(sql2.length()-1)==','){
			sql2.deleteCharAt(sql2.length()-1);
		}
		sql2.append(")");
		return DBAccess.executeUpdate(sql1.append(sql2).toString(), args)>0;
	}
	
	public static boolean updateObject(Object obj){
		List args=new ArrayList();
		StringBuffer sql1=new StringBuffer("update ");
		String sql2=" where id=?";
		Class clazz=obj.getClass();
		String className=clazz.getSimpleName();
		StringBuffer tableName=new StringBuffer(""+Character.toLowerCase(className.charAt(0)));
		for(int i=1;i<className.length();i++){
			char ch=className.charAt(i);
			if(Character.isLowerCase(ch)){
				tableName.append(ch);
			}else{
				tableName.append("_");
				tableName.append(Character.toLowerCase(ch));
			}
		}
		sql1.append(tableName+" set ");
		Field[] fields=clazz.getDeclaredFields();
		for(int i=0;i<fields.length;i++){
			Field field=fields[i];
			if(!isCommonField(field)){
				continue;
			}
			String fieldName=field.getName();
			if("id".equals(fieldName)){
				continue;
			}
			Class fieldType=field.getType();
			String getMethodName="get"+(fieldName.charAt(0)+"").toUpperCase()+fieldName.substring(1,fieldName.length());
			Object value=null;
			try {
				Method getMethod=clazz.getMethod(getMethodName, new Class[]{});
				value=getMethod.invoke(obj, new Object[]{});
				if(value==null){
					continue;
				}
				if(fieldType==Date.class){
					Date d=(Date)value;
					value=new java.sql.Date(d.getTime());
				}
				args.add(value);
			} catch (Exception e) {
				e.printStackTrace();
			}
			StringBuffer columnName=new StringBuffer(""+Character.toLowerCase(fieldName.charAt(0)));
			for(int j=1;j<fieldName.length();j++){
				char ch=fieldName.charAt(j);
				if(Character.isLowerCase(ch)){
					columnName.append(ch);
				}else{
					columnName.append("_");
					columnName.append(Character.toLowerCase(ch));
				}
			}
			sql1.append(columnName+"=?,");
		}
		if(sql1.charAt(sql1.length()-1)==','){
			sql1.deleteCharAt(sql1.length()-1);
		}
		Object id=null;
		try {
			Method getId=clazz.getMethod("getId", new Class[]{});
			id = getId.invoke(obj, new Object[]{});
		} catch (Exception e) {
			e.printStackTrace();
		} 
		args.add(id);
		return DBAccess.executeUpdate(sql1.append(sql2).toString(), args)>0;
	}
	
	public static boolean isCommonField(Field field){
		Class fieldType=field.getType();
		if(fieldType==char.class||fieldType==Character.class){
			return true;
		}else if(fieldType==boolean.class||fieldType==Boolean.class){
			return true;
		}else if(fieldType==int.class||fieldType==Integer.class){
			return true;
		}else if(fieldType==long.class||fieldType==Long.class){
			return true;
		}else if(fieldType==short.class||fieldType==Short.class){
			return true;
		}else if(fieldType==byte.class||fieldType==Byte.class){
			return true;
		}else if(fieldType==float.class||fieldType==Float.class){
			return true;
		}else if(fieldType==double.class||fieldType==Double.class){
			return true;
		}else if(fieldType==String.class){
			return true;
		}else if(fieldType==Date.class){
			return true;
		}
		return false;
	}

	/**
	 * 查询单条记录，以Map形式返回
	 * @param sql 语句
	 * @param args 参数列表
	 * @return
	 */
	public static Map getSingleMap(String sql, List args) {
		Map map = null;
		Connection connection=null;
		PreparedStatement pstmt=null;
		try {
			connection=getConnection();
			pstmt = connection.prepareStatement(sql);
			if (args != null && sql.contains("?")) {
				for (int j = 0; j < args.size(); j++) {
					pstmt.setObject(j + 1, args.get(j));
				}
			}
			ResultSet rs = pstmt.executeQuery();
			ResultSetMetaData rsmd = rs.getMetaData();
			int columnCount = rsmd.getColumnCount();
			if (rs == null) {
				return map;
			}
			if (rs.next()) {
				map = new HashMap();
				for (int i = 1; i <= columnCount; i++) {
					String className = rsmd.getColumnClassName(i);
					String columnName = rsmd.getColumnName(i);
					Class columnClass = Class.forName(className);
					if (columnClass == Blob.class) {
						break;
					}else if(columnClass==Timestamp.class){
						Timestamp stamp=rs.getTimestamp(i);
						map.put(columnName.toLowerCase(), DateUtil.stampToDate(stamp));
					}else{
						Object value = rs.getObject(i);
						map.put(columnName.toLowerCase(), value);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			try {
				pstmt.close();
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return map;
	}

	/**
	 * 查询多条记录，以List存Map的形式返回
	 * @param sql 语句
	 * @param args 参数列表
	 * @return 查询结果
	 */
	public static List getManyMap(String sql, List args) {
		List list = new ArrayList();
		Connection connection=null;
		PreparedStatement pstmt=null;
		try {
			connection=getConnection();
			pstmt = connection.prepareStatement(sql);
			if (args != null && sql.contains("?")) {
				for (int j = 0; j < args.size(); j++) {
					pstmt.setObject(j + 1, args.get(j));
				}
			}
			ResultSet rs = pstmt.executeQuery();
			ResultSetMetaData rsmd = rs.getMetaData();
			int columnCount = rsmd.getColumnCount();
			if (rs == null) {
				return list;
			}
			while (rs.next()) {
				Map map = new HashMap();
				for (int i = 1; i <= columnCount; i++) {
					String className = rsmd.getColumnClassName(i);
					String columnName = rsmd.getColumnName(i);
					Class columnClass = Class.forName(className);
					if (columnClass == Blob.class) {
						break;
					}else if(columnClass==Timestamp.class){
						Timestamp stamp=rs.getTimestamp(i);
						map.put(columnName.toLowerCase(), DateUtil.stampToDate(stamp));
					}else{
						Object value = rs.getObject(i);
						map.put(columnName.toLowerCase(), value);
					}
				}
				list.add(map);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			try {
				pstmt.close();
				connection.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return list;
	}

	public static void main(String[] args) throws SQLException {
		String sql="insert into data_import_table_rule (id,rule_name,end_row,table_name) values (?,?,?,?)"; 
		List args1=new ArrayList();
		args1.add("5");
		args1.add("考勤数据测试");
		args1.add("blank_row");
		args1.add("test_table_name");
		DBAccess.excute(sql, args1);
		
		/*String sql="insert into dic_table_name (id,dic_type,dic_value,dic_name) values (?,?,?,?)";
		List args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("chuli_state");
		args1.add("0");
		args1.add("未处理");
		DBAccess.excute(sql, args1);
		
		args1.clear();
		args1.add(DBAccess.getUuid());
		args1.add("chuli_state");
		args1.add("1");
		args1.add("已处理");
		DBAccess.excute(sql, args1);
		
		args1.clear();
		args1.add(DBAccess.getUuid());
		args1.add("chuli_state");
		args1.add("2");
		args1.add("已关闭");
		DBAccess.excute(sql, args1);*/
		
		/*String sql="insert into data_import_column_rule (id,table_rule_id,is_pk,produce_method,is_unique," +
				"column_name,produce_method_value,max_length) values (?,?,?,?,?,?,?,?)"; 
		List args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(BooleanVariable.TRUE);
		args1.add(ProduceMethodVariable.CUSTOM_METHOD);
		args1.add(BooleanVariable.TRUE);
		args1.add("id");
		args1.add("com.telesound.dataimport.producor.UuidPKProducor");
		args1.add(32);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("que_xian_no");
		args1.add("缺陷号");
		args1.add(32);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("mo_kuai");
		args1.add("模块");
		args1.add(32);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("yan_zhong_xing");
		args1.add("严重性");
		args1.add(32);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,data_type," +
				"header_name,max_length) values (?,?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("unknow_number");
		args1.add(DataTypeVariable.NUMBER);
		args1.add("未知数字");
		args1.add(15);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("test_name");
		args1.add("测试人");
		args1.add(32);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("ze_ren_ren");
		args1.add("责任人");
		args1.add(32);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("ji_bie");
		args1.add("级别");
		args1.add(8);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("que_xian_state");
		args1.add("缺陷状态");
		args1.add(16);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name," +
				"header_name,max_length,is_dictionary,dic_table_name,dic_type_column,dic_type_value," +
				"dic_required_column,dic_reference_column) values (?,?,?,?,?,?,?,?,?,?,?,?)"; 
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("chu_li_state");
		args1.add("处理状态");
		args1.add(16);
		args1.add(BooleanVariable.TRUE);
		args1.add("dic_table_name");
		args1.add("dic_type");
		args1.add("chuli_state");
		args1.add("dic_value");
		args1.add("dic_name");
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"max_length) values (?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("problem");
		args1.add("问题描述");
		args1.add(512);
		DBAccess.excute(sql, args1);
		
		sql="insert into data_import_column_rule (id,table_rule_id,produce_method,column_name,header_name," +
				"data_type,date_format) values (?,?,?,?,?,?,?)";
		args1=new ArrayList();
		args1.add(DBAccess.getUuid());
		args1.add("5");
		args1.add(ProduceMethodVariable.IMPORT_DATA);
		args1.add("t_date");
		args1.add("提出时间");
		args1.add(DataTypeVariable.DATE);
		args1.add("yyyy/MM/dd");
		DBAccess.excute(sql, args1);*/
		
		/*List argss=new ArrayList(); 
		argss.add("2");
		List list=DBAccess.getManyMap("select * from data_import_table_rule",argss);
		for(int i=0;i<list.size();i++){
			Map map=(Map)list.get(i);
			Iterator it=map.keySet().iterator(); 
			while(it.hasNext()){ 
				Object key=it.next(); 
				System.out.print("["+key+":"+map.get(key)+"]"); 
			}
			System.out.println(); 
		}*/

		
		/*List argss=new ArrayList(); 
		argss.add("2"); 
		Map map=DBAccess.getSingleMap("select * from data_import_table_rule where id='5'", argss); 
		Iterator it=map.keySet().iterator();
		while(it.hasNext()){ 
			Object key=it.next();
			Object value=map.get(key);
			if(value!=null&&value.getClass()==java.sql.Date.class){
				value=new Date(((java.sql.Date)value).getTime());
			}
			System.out.print("["+key+":"+value+"]"); 
			if(value!=null){
				System.out.print(map.get(key).getClass().getName());
			}
		}*/
		
		 
		
		/*List argss=new ArrayList(); 
		argss.add("2"); 
		argss.add("修改规则名称了");
		argss.add("2"); 
		String sql="update data_import_table_rule set end_row=?,rule_name=? where id=?"; 
		DBAccess.executeUpdate(sql, argss);*/
		
		/*List argss=new ArrayList(); 
		List args1=new ArrayList();
		args1.add("5"); 
		args1.add("修改规则名称了ya"); 
		args1.add("2");
		argss.add(args1); 
		List args2=new ArrayList(); 
		args2.add("6");
		args2.add("修改规则名称了ma"); 
		args2.add("1"); 
		argss.add(args2); 
		String sql="update data_import_table_rule set end_row=?,rule_name=? where id=?"; 
		DBAccess.executeBatchUpdate(sql, argss);*/
		
		/*List argss=new ArrayList(); 
		List args1=new ArrayList();
		args1.add("2");
		argss.add(args1); 
		String sql="delete from data_import_table_rule where id=?"; 
		DBAccess.excuteBatch(sql, argss);*/
		//DBAccess.setDataSource("bank");
		//System.out.println(getUuid());
		
		//saveObject(new DataImportTableRule());
	}
}
